# -*- coding: utf-8 -*-
import time
import re
from zhdate import ZhDate
from datetime import datetime
import os
import shutil


def Lunar_Calendar():
    try:
        DataYmd = dateY, datem, dated = int(time.strftime("%Y", time.localtime())), int(
            time.strftime("%m", time.localtime())), int(time.strftime("%d", time.localtime()))
        DataYmd = ZhDate.from_datetime(datetime(*DataYmd))
        DataYmd = re.compile(r'(\d+年)').findall(str(DataYmd))
        DataYmd = re.compile(r'(\d+)').findall(str(DataYmd))
        return DataYmd[0]
    except:
        return '2023'

def filemove():
    print(os.listdir('../static/assets/js'))
    namelist = []
    with open(r'../templates/base/backstage.html', 'r', encoding='utf-8') as f:
        a = f.readlines()
    for i in a[965:1002]:
        s = (i.strip().split('<script src="../vendors/'))
        if len(s) == 2 :
            namelist.append('<script src="/static/assets/js/' +s[1] + '\n')
            # namelist.append(s[1].split('"></script>')[0])
    with open(r'aa.html', 'w', encoding='utf-8') as f:
        f.writelines(namelist)
    print(os.listdir('/Users/liu/Desktop/gentelella-master/vendors'))


# import time
# from flask import Blueprint, redirect, render_template, session, make_response, request, url_for
# import myblog.myCrypto as aAES
# from werkzeug.exceptions import HTTPException
# # from flask_sqlalchemy import SQLAlchemy
# # db = SQLAlchemy()
# from .app import app
#
# @app.route('/')
# def index():
#     data_obj = {
#         'date': time.asctime(),
#         'date_year': time.strftime("%Y", time.localtime( time.time() ) ),
#
#
#     }
#     name_session = session['username'] if 'username' in session else None
#     data_obj['name_session'] = name_session
#     return render_template('/blog/index.html', data_obj = data_obj )
#
# @app.route('/aa')
# def cs():
#     jia = aAES.Encrypt('千印', 'd7f389ab0f4e0b21402af32ea3fb8d85', 'l7sgZAUxoMzoCzhQ')
#     jie = aAES.Decrypt('DKv8iX44nhyqXcbSOMx4rd+P5A5f36Knb0BNeDOjrsRlTrrQ2nzSARjPJX/dzICY', 'd7f389ab0f4e0b21402af32ea3fb8d85', 'l7sgZAUxoMzoCzhQ')
#     # print(models.BlogUser)
#     return render_template('/error-404.html', info=jia)
#